Using Web Service in C# [deprecated]
This is a short example for a C# .NET web service call.
Before you begin
This working example was created on June 2011 using the following prerequisites:
- Availability of the Microsoft .NET FrameWork
- Microsoft Visual Studio
About this task
- Create a Visual Studio Project, e.g. a Console Application
- Add a web service reference
- Navigate to the project and right click References section. Select Add Service Reference...
- To add an ASMX based web service reference, click the Advanced... button below
- Now click Add Web Reference..., now add as URL:
http://ish.example.com/ISHWS/Application25.asmx(whereishrefers to an example server dedicated to Content Manager) and name itInfoShareApplication25
- Inside the code you should now be able to write something like:
using System; namespace ExampleConsoleApplication { class Program { // Used to prefix every web service call, easy redirect to different web/app server static string baseUrl = "http://ish.example.com/ISHWS/"; static void Main(string[] args) { try { string myContext = GetContext(); Console.WriteLine("myContext[" + myContext + "]"); } catch (Exception exception) { Console.WriteLine(exception.Message); Console.WriteLine(exception.StackTrace); } Console.ReadLine(); } static string GetContext() { //Creating the objects InfoShareApplication25.Application25 myInfoShareApplication25 = new InfoShareApplication25.Application25(); string myContext = ""; //Redirecting the dynamic URL to the current test machine myInfoShareApplication25.Url = baseUrl + "Application25.asmx"; //Doing the login call myInfoShareApplication25.Login("ISHCM", "Admin", "admin", ref myContext); return myContext; } } } - Execution should give you an encrypted context in variable
myContext.